package com.huihuiyun.huihuiyun.server.endpoint;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class SinglePageApplicationController {

//    /******************************************
//     * context client
//     ******************************************/
//    private static final String ContextClient = "/client";
//
//    @RequestMapping(
//        value = {
//            ContextClient + "/",
//        })
//    public String redirectClientIndex() {
//        return "forward:" + ContextClient + "/index.html";
//    }
//
//    @RequestMapping(
//        value = {
//            ContextClient + "/{path0:^[a-zA-Z0-9]*$}",
//        })
//    public String redirectClientIndex(@PathVariable String path0) {
//        return "forward:" + ContextClient + "/index.html";
//    }
//
//    @RequestMapping(
//        value = {
//            ContextClient + "/{path1:^[a-zA-Z0-9]*$}/{path2:^[a-zA-Z0-9]*$}"
//        })
//    public String redirectClientIndex(@PathVariable String path1, @PathVariable String path2) {
//        return "forward:" + ContextClient + "/index.html";
//    }
//
//    /******************************************
//     * context manager
//     ******************************************/
//    private static final String ContextManager = "/manager";
//
//    @RequestMapping(
//        value = {
//            ContextManager + "/",
//        })
//    public String redirectManagerIndex() {
//        return "forward:" + ContextManager + "/index.html";
//    }
//
//    @RequestMapping(
//        value = {
//            ContextManager + "/{path0:^[a-zA-Z0-9]*$}",
//        })
//    public String redirectManagerIndex(@PathVariable String path0) {
//        return "forward:" + ContextManager + "/index.html";
//    }
//
//    @RequestMapping(
//        value = {
//            ContextManager + "/{path1:^[a-zA-Z0-9]*$}/{path2:^[a-zA-Z0-9]*$}"
//        })
//    public String redirectManagerIndex(@PathVariable String path1, @PathVariable String path2) {
//        return "forward:" + ContextManager + "/index.html";
//    }

    /******************************************
     * context manager-website
     ******************************************/
    private static final String ContextManagerWebsite = "/manager-website";

    @RequestMapping(
            value = {
                    ContextManagerWebsite + "/",
            })
    public String redirectContextManagerWebsiteIndex() {
        return "forward:" + ContextManagerWebsite + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextManagerWebsite + "/{path0:^[a-zA-Z0-9]*$}",
            })
    public String redirectContextManagerWebsiteIndex(@PathVariable String path0) {
        return "forward:" + ContextManagerWebsite + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextManagerWebsite + "/{path1:^[a-zA-Z0-9]*$}/{path2:^[a-zA-Z0-9]*$}"
            })
    public String redirectContextManagerWebsiteIndex(@PathVariable String path1, @PathVariable String path2) {
        return "forward:" + ContextManagerWebsite + "/index.html";
    }

    /******************************************
     * context agent-website
     ******************************************/
    private static final String ContextAgentWebsite = "/agent-website";

    @RequestMapping(
            value = {
                    ContextAgentWebsite + "/",
            })
    public String redirectContextAgentWebsiteIndex() {
        return "forward:" + ContextAgentWebsite + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextAgentWebsite + "/{path0:^[a-zA-Z0-9]*$}",
            })
    public String redirectContextAgentWebsiteIndex(@PathVariable String path0) {
        return "forward:" + ContextAgentWebsite + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextAgentWebsite + "/{path1:^[a-zA-Z0-9]*$}/{path2:^[a-zA-Z0-9]*$}"
            })
    public String redirectContextAgentWebsiteIndex(@PathVariable String path1, @PathVariable String path2) {
        return "forward:" + ContextAgentWebsite + "/index.html";
    }

    /******************************************
     * context seller-website
     ******************************************/
    private static final String ContextSellerWebsite = "/seller-website";

    @RequestMapping(
            value = {
                    ContextSellerWebsite + "/",
            })
    public String redirectContextSellerWebsiteIndex() {
        return "forward:" + ContextSellerWebsite + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextSellerWebsite + "/{path0:^[a-zA-Z0-9]*$}",
            })
    public String redirectContextSellerWebsiteIndex(@PathVariable String path0) {
        return "forward:" + ContextSellerWebsite + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextSellerWebsite + "/{path1:^[a-zA-Z0-9]*$}/{path2:^[a-zA-Z0-9]*$}"
            })
    public String redirectContextSellerWebsiteIndex(@PathVariable String path1, @PathVariable String path2) {
        return "forward:" + ContextSellerWebsite + "/index.html";
    }

    /******************************************
     * context client
     ******************************************/
    private static final String ContextClient = "/client";

    @RequestMapping(
            value = {
                    ContextClient + "/",
            })
    public String redirectContextClientIndex() {
        return "forward:" + ContextClient + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextClient + "/{path0:^[a-zA-Z0-9]*$}",
            })
    public String redirectContextClientIndex(@PathVariable String path0) {
        return "forward:" + ContextClient + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextClient + "/{path1:^[a-zA-Z0-9]*$}/{path2:^[a-zA-Z0-9]*$}"
            })
    public String redirectContextClientIndex(@PathVariable String path1, @PathVariable String path2) {
        return "forward:" + ContextClient + "/index.html";
    }

    /******************************************
     * context member client
     ******************************************/
    private static final String ContextMemberClient = "/member-client";

    @RequestMapping(
            value = {
                    ContextMemberClient + "/",
            })
    public String redirectContextMemberClientIndex() {
        return "forward:" + ContextMemberClient + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextMemberClient + "/{path0:^[a-zA-Z0-9]*$}",
            })
    public String redirectContextMemberClientIndex(@PathVariable String path0) {
        return "forward:" + ContextMemberClient + "/index.html";
    }

    @RequestMapping(
            value = {
                    ContextMemberClient + "/{path1:^[a-zA-Z0-9]*$}/{path2:^[a-zA-Z0-9]*$}"
            })
    public String redirectContextMemberClientIndex(@PathVariable String path1, @PathVariable String path2) {
        return "forward:" + ContextMemberClient + "/index.html";
    }
}
